<cfset ID = #client.chapa#>
<cfif IsDefined("url.DocNo")>
    <!---CFQUERY NAME="qryOriginator" DATASOURCE="#client.company_dsn#">
        SELECT     USERID
        FROM         CRGROUTEMAIN
        WHERE    ROUTEID = '#url.DocNo#'
    </cfquery>
    <CFQUERY NAME="qryUser" DATASOURCE="#client.global_dsn#">
        select guid from egrgusermaster where userid ='#qryOriginator.USERID#' 
    </cfquery>
     <CFQUERY NAME="qryPID" DATASOURCE="#client.company_dsn#">
         select personnelidno from cmfpa where guid ='#qryUser.guid#'
    </cfquery--->
    <CFQUERY NAME="qryPID" DATASOURCE="#client.company_dsn#">
         select personnelidno from cinleaveappsi where routeid = '#url.DocNo#'
    </cfquery>
    <cfset ID = #qryPID.personnelidno#>
</cfif>
<cfquery name="getCMFPA" datasource="#client.company_dsn#">
	select * from cmfpa where personnelidno ='#ID#'
</cfquery>
<cfquery name="getVLBLNCE" datasource="#client.company_dsn#">
	select * from CINLVENTITLEMENT where LEAVETYPE ='VAC_LV'
    and personnelidno ='#ID#'
</cfquery>
<cfquery name="getSLBLNCE" datasource="#client.company_dsn#">
	select * from CINLVENTITLEMENT where LEAVETYPE ='SICK_LV'
    and personnelidno ='#ID#'
    
</cfquery>
<cfset VL = "No Available Balance">
<cfif #getVLBLNCE.LEAVEENTITLEMENT# neq "">     
	<cfset VL = #getVLBLNCE.LEAVEENTITLEMENT#>
</cfif>
<cfset SL = "No Available Balance">
<cfif #getSLBLNCE.LEAVEENTITLEMENT# neq "">     
	<cfset SL = #getSLBLNCE.LEAVEENTITLEMENT#>
</cfif>


<table>
	<tr>
    	<td>Name:</td><td><cfoutput>#getCMFPA.lastname#, #getCMFPA.firstname# #getCMFPA.middlename#</cfoutput></td>
    </tr>
    <tr>
        <td>VL Balance:</td><td style="color:red"><cfoutput>#VL#</cfoutput></td>
    </tr>
    <tr>
        <td>SL Balance:</td><td style="color:red"><cfoutput>#SL#</cfoutput></td>
    </tr>
</table>